<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\ClassroomuseSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '教室使用';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="classroomuse-model-index">

   
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('添加', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

//             'id',
            'stu_id',
            'stu_name',
            'title',
            'classroom',
            'telephone',
            'time',
        		'moment',
            'approved',
            'feedbacked',
            'remark',

        	[
        		'class' => 'yii\grid\ActionColumn',
        		'header' => '操作',
        		'template' => '{agree}{disagree}{view}{delete}',
        		'buttons' =>
        		[
        				'agree' => function ($url,$model, $key) {
        				return $model->approved=='审批中'?Html::a('<button>同意</button> ', '/bnews/web/classroomuse/agree?id='.$model->id,['title' => '同意'] ):'';
        				},
        				'disagree' => function ($url,$model, $key) {
        				return $model->approved=='审批中'?Html::a(' <button>不同意</button> ', '/bnews/web/classroomuse/disagree?id='.$model->id, ['title' => '不同意'] ):'';
        				},
                        'view' => function ($url,$model, $key) {
                        return Html::a('<button>详情</button> ', '/bnews/web/classroomuse/view?id='.$model->id,['title' => '详情'] );
                        },
                        'delete' => function ($url,$model, $key) {
                            return Html::a(' <button>删除</button> ', '/bnews/web/classroomuse/delete?id='.$model->id, ['title' => '删除'] );
                        },

        				],
        				'headerOptions' => ['width' => '220'],
        		
        	],
        ],
    ]); ?>
</div>
